﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Common;

namespace ServerYuGi
{
    public class DrawPhase : ITurn 
    {

        public DrawPhase()
        {
            STurnManager.Register(EnumState.DrawPhase, this);
        }

        #region ITurn Members

        public void SBeginTurn(SSupervisor super)
        {            
            //super.ServerSocket.SendMessageToEveryOne(YMSG.TURN_DRAWPHASE_BEGIN, super.TurnManager.IDPlayerTrongLuot);
            int IDPlayerRutBai = super.TurnManager.IDPlayerTrongLuot;
            SPlayer player = super.LayPlayer(IDPlayerRutBai);
            super.SendMessage_TURN_DRAWPHASE_BEGIN_ToAll(IDPlayerRutBai);
            //super.SendMessage_TURN_DRAWPHASE_BEGIN_ToAll(super.TurnManager.IDPlayerTrongLuot);
        }
        public void SEndTurn(SSupervisor super)
        {           
            //super.ServerSocket.SendMessageToEveryOne(YMSG.TURN_DRAWPHASE_END, super.TurnManager.IDPlayerTrongLuot);
            super.SendMessage_TURN_DRAWPHASE_END_ToAll(super.TurnManager.IDPlayerTrongLuot);
        }
        public bool CheckYMSG(YMSG message)
        {
            if (TURNYMSG.Contains(message))
                return true;
            return false;
        }
       
        #endregion

        public static List<YMSG> TURNYMSG = new List<YMSG> 
        {
            YMSG.CARD_RUTBAI, // Gửi cho player nào rút bài 
            YMSG.CARD_RUTBAI_XONG,// Player rút bài xong gửi về cho server, server gửi message này về cho player kia
            YMSG.TURN_DRAWPHASE_BEGIN, // bắt đầu drawphase
            YMSG.TURN_DRAWPHASE_END, // kết thúc drawphase
            YMSG.TURN_SKIP
        };
    }
}
